package cn.wjx.taobaounion.utils;

import android.content.Context;
import android.inputmethodservice.InputMethodService;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

/**
 * @author WuChangJian
 * @date 2020/6/27 20:45
 */
public class KeyboardUtil {

    public static void hide(Context context, View v) {
        InputMethodManager im = (InputMethodManager) context.getSystemService(InputMethodService.INPUT_METHOD_SERVICE);
        im.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }

    public static void show(Context context, View v) {
        InputMethodManager im = (InputMethodManager) context.getSystemService(InputMethodService.INPUT_METHOD_SERVICE);
        im.showSoftInput(v, 0);
    }
}
